Preview and Download Selected Documents as PDFs in Business Central Using AL
In Microsoft Dynamics 365 Business Central, users frequently need to generate and review Purchase Order (PO) documents. Traditionally, this process involved downloading PDF files locally and then opening them with an external PDF viewer. While functional, this workflow can be inefficient, especially when reviewing multiple purchase orders. With recent enhancements in the AL language and web client capabilities, it is now possible to preview PDF documents directly within the browser, eliminating unnecessary steps and improving user experience. Additionally, Business Central continues to support direct file downloads for scenarios where saving a copy locally is required. This article presents a customization to the Purchase Order List page, allowing users to select multiple purchase orders and either preview or download their PDF documents using AL code. Functional Overview The proposed solution introduces a new action on the Purchase Order List page titled “Preview Selected Purchase Orders”. This action performs the following tasks: Role of Report Selections Report Selections play a vital role in ensuring flexibility and modularity. Instead of hardcoding specific report IDs, the system determines the report to be used for each Purchase Order based on vendor configuration. Example AL Snippet: This method respects configurations made in the Report Selection – Purchase page, allowing different vendors to use different report formats or layouts for the same document type. AL Implementation Below is the complete AL code for the pageextension object: File Handling Options: Preview vs Download Depending on business needs, developers can choose between two methods: 1. File.ViewFromStream 2. File.DownloadFromStream Output This customization provides two ways to handle PDF outputs for Purchase Orders: 1. For a Single Selected Document When a single purchase order is selected and the action is triggered: 2. For Multiple Selected Documents (Merged into One PDF) Business Benefits To Conclude, by leveraging AL capabilities such as Report Selections, Temp Blob, and the File data type methods, developers can significantly enhance document handling processes in Microsoft Dynamics 365 Business Central. Offering both in-browser preview and direct download options provides users with flexibility and improves overall productivity. This customization is a practical example of how small enhancements can deliver substantial value in day-to-day business operations. We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfronts.com.
Share Story :
A Unified Approach to Developing Finance and Operations Applications
Microsoft’s Unified Developer Experience (UDE) helps developers build solutions that work across both Finance and Operations (F&O) and the Power Platform by providing a common, cloud-based environment. Challenges Before UDE Before UDE, developers often faced the following issues: What UDE Changes With UDE, Microsoft combines these tools into one environment, making it easier to: Why UDE Is Useful Adopting UDE brings several practical benefits for developers and organizations: Check Access, Licenses, and Capacity Before starting, make sure your user role, license, and environment capacity are all set up properly. You can check this in the Power Platform Admin Center. Starting the Setup with PowerShell To get started, open PowerShell ISE on your laptop. If you haven’t installed the required Power Platform module yet, run this command (skip it if it’s already installed): #Install the module Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Force Next, sign in to your account and prepare the JSON template that defines your environment settings. Make sure DevToolsEnabled is set to true so developer tools are available. You can also set DemoDataEnabled to true if you want sample Contoso data included by default. Write-Host “Creating a session against the Power Platform API” Add-PowerAppsAccount -Endpoint prod #To construct the json object to pass in $jsonObject= @” { “PostProvisioningPackages”: [ { “applicationUniqueName”: “msdyn_FinanceAndOperationsProvisioningAppAnchor”, “parameters”: “DevToolsEnabled=true|DemoDataEnabled=true” } ] } “@ | ConvertFrom-Json Finally, you’re ready to start the environment deployment. New-AdminPowerAppEnvironment -DisplayName “EnvironmentName” -EnvironmentSku Sandbox -Templates “D365_FinOps_Finance” -TemplateMetadata $jsonObject -LocationName “unitedstates” -ProvisionDatabase Example: New-AdminPowerAppEnvironment -DisplayName “Basic_Env” -EnvironmentSku Sandbox -LocationName “unitedstates” -Templates “D365_FinOps_Finance” -TemplateMetadata $jsonObject -ProvisionDatabase Make sure to use a proper name for your environment — it must be 20 characters or fewer. Also, pick the correct data center location based on your region (for example, I used unitedstates, but you could choose India or another available region). Alternatively: Install on an Existing Environment If you already have a Power Platform environment with a Dataverse database, you can use it to install Finance and Operations apps. Simply select the environment, navigate to Resources > Dynamics 365 apps, and then select Dynamics 365 Finance and Operations Provisioning App. Once your environment is successfully provisioned, you’ll see it listed in the Power Platform Admin Center — just like in the screenshot above. Here’s what the key information means: You’ll also see links to manage: These settings help control access and structure within your environment. This confirms your Finance + Power Platform environment is now fully functional and integrated — ready for development, testing, and customization. Make sure your user account has the System Administrator security role in Dataverse. Once assigned, this role will automatically carry over to the Finance and Operations (F&O) environment — no need to reassign it separately. If you navigate to the Dynamics 365 apps, you’ll also find pre-configured and installed solutions available. You can check out the Modules, Packages, and Operation History by simply clicking on the Environment URL. System Requirements for Setting Up the Development Environment Before you begin working with the Unified Development Experience (UDE), it’s important to make sure your machine meets the basic hardware and software requirements. Here’s what you’ll need: Workstation Requirements To ensure smooth performance while developing: Required Software The following software components are essential for working with UDE in Visual Studio: Once everything is set up, you’re ready to open Visual Studio. Make sure to run it as Administrator and choose the “Continue without code” option when prompted. This ensures all tools load properly and you’re ready to begin your development work. Install Power Platform VS Extension Go to VS > Manage Extensions > Search ‘Power Platform Tools Now, navigate to Tools > Options > Power Platform Tools and enable the specified parameters. Now, go to Tools > Connect to Dataverse Always show the full list of organizations. Avoid signing in with your current Windows user if it’s not the same account you’ve already connected to in Visual Studio. You can view the environments you previously created in PowerShell – just select the one you set up earlier. Choose the default option, unless you’re planning to create specific components for D365 CE or Power Platform—in that case, it’s best to create a dedicated solution and publisher for your work. If the X++ source code for your specific UnO DevBox version (e.g., 10.0.35) hasn’t been downloaded yet, you’ll be prompted to get it locally. After setting up the Power Platform Tools extension and connecting to your Dataverse sandbox, you’ll see an option to install the Finance and Operations extension for Visual Studio, along with the related metadata. If you didn’t get any option you can download it manually by going to “C:\Users\ShubhamPrajapati\AppData\Local\Microsoft\Dynamics365\10.0.2263.74” Meanwhile, in the background, the PackageLocalDirectory is being extracted. You can monitor the progress by going to View > Output. The installation typically takes around 30 minutes. After installation, you’ll see a few prompts the first time you open Visual Studio—just click “Yes” to continue. As you can see, all models have been downloaded successfully. You can switch between Classic View and Model View by right-clicking on the AOT. Once that’s done, navigate to Tools > Options > Power Platform Tools and apply the required changes as shown in the image below. The final step is to configure the Finance & Operations extension. In my case, I use LocalDB for the Cross Reference (Cross Ref) Database—it’s convenient because it’s already included when you install Visual Studio. If you’re using LocalDB, ensure your connection string is correct. A typical value is: (localdb)\ To set up LocalDB (if not already initialized), open Command Prompt and run: sqllocaldb create MSSQLLocalDB -s This command initializes and starts the LocalDB instance. Once LocalDB is running, your Cross Reference Database will be restored. This enables key development features such as: These features significantly enhance the development experience by improving code navigation and reference tracking. If you receive errors when trying to open certain class files (which are XML files under the hood), it’s likely because the Modeling SDK is not installed. This SDK is essential for working with … Continue reading A Unified Approach to Developing Finance and Operations Applications
Share Story :
Mastering String Functions in Business Central: Practical Examples with AL
When working with Microsoft Dynamics 365 Business Central, string manipulation is an essential part of everyday development. From reversing names to formatting messages, AL provides multiple ways to handle text. In this blog, we’ll explore different approaches to string handling through practical examples, including custom logic and built-in AL string functions. Why String Handling Matters in Business Central Strings are everywhere—customer names, item descriptions, invoice messages, and more. Being able to manipulate these strings efficiently allows developers to: Let’s dive into some real-world AL examples where we extend the Customer List page with new actions for string manipulation. Part 1: Custom String Handling Approaches 🔹 a) Method 1: Using List of Text We can reverse a string by adding each character into a List of [Text] and then calling .Reverse(). action(CFS_ReverseSelectedCustomerName) { Caption = ‘Reverse Customer Name’; ApplicationArea = All; trigger OnAction() var StringList: List of [Text]; StringLetter: Text; ReversedString: Text; begin ReversedString := ”; foreach StringLetter in Rec.Name do StringList.Add(StringLetter); StringList.Reverse(); foreach StringLetter in StringList do ReversedString += StringLetter; Message(ReversedString); end; } This approach is useful when you want more control over the collection of characters. Output: Method 2: Using Index Manipulation Here, we iterate through the string from end to start and build the reversed string. action(CFS_NewIndex) { Caption = ‘New Index’; ApplicationArea = All; trigger OnAction() var ReversedString: Text; i: Integer; begin for i := StrLen(Rec.Name) downto 1 do ReversedString += CopyStr(Rec.Name, i, 1); Message(ReversedString); end; } A more direct approach, simple and efficient for reversing text. Method 3: Using CopyStr The CopyStr function is perfect for extracting characters one by one. action(CFS_NewText) { Caption = ‘New Text’; ApplicationArea = All; trigger OnAction() var ReversedString: Text; i: Integer; begin for i := StrLen(Rec.Name) downto 1 do ReversedString += CopyStr(Rec.Name, i, 1); Message(ReversedString); end; } Part 2: Built-in AL String Functions Beyond custom logic, AL offers powerful built-in functions for working with text. Let’s explore a few. Evaluate Examples The Evaluate function converts text into other datatypes (integer, date, boolean, duration, etc.). action(CFS_EvaluateExamples) { Caption = ‘Evaluate Examples’; ApplicationArea = All; trigger OnAction() var MyInt: Integer; MyDate: Date; MyBool: Boolean; MyDuration: Duration; Value: Text; OkInt: Boolean; OkDate: Boolean; OkBool: Boolean; OkDur: Boolean; begin Value := ‘150’; OkInt := Evaluate(MyInt, Value); Value := ‘2025-09-01’; OkDate := Evaluate(MyDate, Value); Value := ‘TRUE’; OkBool := Evaluate(MyBool, Value); Value := ‘3d 5h 45m’; OkDur := Evaluate(MyDuration, Value); Message( ‘Integer = %1 (Ok: %2)\Date = %3 (Ok: %4)\Boolean = %5 (Ok: %6)\Duration = %7 (Ok: %8)’, MyInt, OkInt, MyDate, OkDate, MyBool, OkBool, MyDuration, OkDur); end; } Super handy when parsing user input or imported text data. String Functions Examples Now let’s use some of the most common string functions in AL. action(CFS_StringFunctions) { Caption = ‘String Functions’; ApplicationArea = All; trigger OnAction() var SourceTxt: Text[100]; CopyTxt: Text[50]; DelTxt: Text[50]; Len: Integer; SubstTxt: Text[100]; UpperTxt: Text[50]; LowerTxt: Text[50]; begin SourceTxt := ‘Dynamics 365 Business Central’; CopyTxt := CopyStr(SourceTxt, 1, 8); // “Dynamics” DelTxt := DelStr(SourceTxt, 1, 9); // “365 Business Central” Len := StrLen(SourceTxt); // 29 SubstTxt := StrSubstNo(‘Hello %1, welcome to %2!’, ‘User’, ‘Business Central’); UpperTxt := UpperCase(SourceTxt); // “DYNAMICS 365 BUSINESS CENTRAL” LowerTxt := LowerCase(SourceTxt); // “dynamics 365 business central” Message( ‘Original: %1\CopyStr: %2\DelStr: %3\Length: %4\Substitute: %5\Upper: %6\Lower: %7’, SourceTxt, CopyTxt, DelTxt, Len, SubstTxt, UpperTxt, LowerTxt); end; } These built-in functions save time and make string handling straightforward. To conclude, whether you’re reversing a customer’s name, converting text into other data types, or formatting user-friendly messages, AL’s string manipulation capabilities are both flexible and powerful. By combining custom logic with built-in functions, you can handle almost any text-related scenario in Business Central. Try experimenting with these functions in your own extensions—you’ll be surprised how often they come in handy! We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfronts.com.
Share Story :
Getting Started with the Event Recorder in Business Central
When developing customizations or extensions in Microsoft Dynamics 365 Business Central, working with events is a best practice. Events help ensure your code is upgrade-safe and cleanly decoupled from the standard application code. However, one common challenge developers face is figuring out which events are triggered during certain actions in the system. That’s where the Event Recorder comes in. What Is the Event Recorder? The Event Recorder is a built-in tool in Business Central that allows developers to monitor and log all published and subscribed events during a user session. Think of it as a “black box” recorder for event-driven development. It helps you identify: This tool is extremely helpful when you’re customizing functionality using event subscriptions (as per AL best practices) but aren’t sure which event to subscribe to. Why Use the Event Recorder? Traditionally, developers had to dig through AL code or documentation to find the right event to subscribe to. With the Event Recorder, this becomes faster and more efficient. Key benefits include: How to Use the Event Recorder Here’s a step-by-step guide: Step 1: Open Event Recorder Step 2: Start a New Recording Step 3: Stop Recording Step 4: Review the Results Best Practices Sample Use Case Suppose you’re trying to add custom logic every time a Sales Invoice is posted. You’re not sure which event gets triggered at that point. Using the Event Recorder: Now, you can write a subscriber in your AL code like this: [EventSubscriber(ObjectType::Page, Page::”Customer List”, ‘OnAfterGetRecordEvent’, ”, true, true)] local procedure MyProcedure() begin // Your custom logic here end; Limitations While powerful, the Event Recorder does have some limitations: To conclude, Event Recorder is an indispensable tool for any AL developer working in Business Central. It simplifies the discovery of relevant events, helps maintain clean and upgrade-safe extensions, and boosts overall development efficiency. Whether you’re new to AL or a seasoned developer, incorporating the Event Recorder into your workflow will save you time. We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.
Share Story :
Generate Enhanced QR Codes in Business Central Using AL and QuickChart API
QR codes have become a standard tool for sharing data quickly and efficiently—whether it’s for product labeling, document tracking, or digital payments. Now, you can generate customized QR codes and barcodes directly within Microsoft Dynamics 365 Business Central using a simple action. This feature allows users to choose the barcode type and size, embed the image into a record, and optionally download it—all with just a few clicks. It’s an easy way to enhance records with scannable information, without leaving Business Central or needing external tools. In this article, we’ll walk through how this feature works and how it can be used in real business scenarios. What This Feature Does? The “Generate Enhanced QR Code” action gives users the ability to quickly create and manage barcodes within Business Central. Here’s what it can do: Business Scenarios Where This Shines AL Code Behind the Feature Output: Choose an image size (Small, Medium, Large). Select a barcode type (QR, Swiss QR, Aztec, Data Matrix, Telepen). Store the generated image in the Picture field of the item record. To conclude, this customization shows how a simple AL code extension can greatly boost efficiency in Microsoft Dynamics 365 Business Central. By enabling quick generation and embedding of QR codes and barcodes, you eliminate manual steps and streamline processes across departments—from inventory to sales and beyond. With support for multiple barcode types, customizable sizes, and built-in download and validation prompts, this feature brings powerful functionality right into the user’s workflow—no external tools needed. Whether you’re in warehousing, retail, manufacturing, or pharma, this tool helps standardize product labeling and enhances traceability with just a few clicks. Looking ahead? You can extend this further by including additional record fields, customizing encoding logic, or supporting more document types like purchase orders or invoices. We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.
Share Story :
Enhancing Number Series in Business Central: New Architecture and Copilot Integration
As Business Central continues to advance, its features and functionalities are also evolving. One significant enhancement is the introduction of a new series system. This update is designed to simplify the process of assigning numbers to various documents, ensuring both consistency and efficiency. In this blog, we’ll explore the core aspects of this new number series and how you can leverage it in your Business Central environment. Understanding the Basics Number series in Business Central serve as unique identifiers for documents such as sales orders, purchase orders, and invoices. These identifiers play a crucial role in effectively tracking and managing documents. With the introduction of the new number series, improvements have been made to enhance flexibility and provide better control over these identifiers. What’s New? Previously, Business Central used the NoSeriesManagement codeunit for managing number series. The updated system introduces two distinct entities: This new structure brings a more organized and streamlined approach to number series management, enabling enhanced customization for different document types and processes. Refactoring Your Code With these updates, the NoSeriesManagement codeunit is now marked for deprecation. When you use it, you may encounter a warning like: “Codeunit ‘NoSeriesManagement’ is marked for removal. Reason: Please use the ‘No. Series’ and ‘No. Series – Batch’ codeunits instead. Tag: 24.0”. Here’s a step-by-step guide to refactoring your code for the new system: 1. Identify Usage First, locate all instances where the NoSeriesManagement codeunit is referenced in your codebase. This includes direct calls or any references to its functions. 2. Replace with New Codeunits Update these references to use the appropriate new codeunit: How to Implement the New Codeunits a. Using “No. Series” This codeunit is used for standard number series management tasks. Below is an example of how it works: var NoSeries: Codeunit “No. Series”;begin NoSeries.GetLastNoUsed(); NoSeries.GetNextNo();end; b. Using “No. Series – Batch” The “No. Series – Batch” codeunit is designed for efficient batch processing of multiple number series. Use its methods like PeekNextNo to retrieve the next number without modifying the series. var NoSeriesBatch: Codeunit “No. Series – Batch”;begin NoSeriesBatch.GetLastNoUsed(); NoSeriesBatch.PeekNextNo();end; Example: Before and After Refactoring Before Refactoring: After Refactoring: Suggesting No. Series Using Copilot in Business Central Business Central’s Copilot integration simplifies generating and managing No. Series for different modules. Follow this step-by-step guide to utilize this feature effectively: 2. Create a New Number Series 3. Generate Number Series for a Specific Module 4. Modify an Existing Number Series 5. Prepare Number Series for the Next Year This feature empowers users to efficiently manage No. Series with minimal manual effort, ensuring consistency and saving valuable time. Explore the Copilot suggestions to optimize your workflow in Business Central! To conclude, the advancements in Business Central’s Number Series management, with the introduction of the new architecture and Copilot integration, offer a significant leap in flexibility, efficiency, and user experience. The updated “No. Series” and “No. Series – Batch” codeunits streamline workflows, while Copilot simplifies the creation, modification, and futureproofing of number series with intelligent suggestions. By adopting these features, businesses can ensure consistency, reduce manual errors, and save valuable time, making their operations more streamlined and future ready. Explore these enhancements today to unlock the full potential of Business Central! We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.
Share Story :
Implementing Encryption and Decryption Functions via API in Business Central
In Microsoft Dynamics 365 Business Central, securing sensitive data like passwords is crucial for protecting both businesses and customers. By the end of this post, you will understand how passwords are encrypted before being stored and decrypted only when necessary. This ensures that passwords remain secure, minimizing exposure and building trust. 1. Storing Encrypted Passwords Passwords are encrypted before being stored in the database to ensure they are protected. This prevents anyone from accessing passwords in plain text, even if they gain unauthorized access to the database. Here’s an example of how a custom table, CFSCustomPage, stores encrypted passwords using the EncodePassword procedure. In the above code, the password is encrypted before being stored in the database to ensure the data remains secure. The EncodePassword procedure is used for encrypting the password. 2. Decrypting Passwords When Needed When passwords need to be retrieved, they are decrypted using the DecodePassword procedure. This ensures that passwords are only accessible when required, minimizing exposure. Here’s the decryption function: In the above code, passwords are decrypted only when needed, allowing the system to securely handle sensitive data. 3. Returning Decrypted Passwords via API For external systems or applications requiring access to customer data, Business Central ensures that passwords are only decrypted and transmitted securely via API. This way, customer information remains protected throughout the process. Here’s how the API Page CFSCustPageAPI handles this: The API exposes the encrypted password and only decrypts it when accessed securely through the API. 4. Returning Decrypted Passwords in a List Page Passwords can also be decrypted and displayed in a list page when necessary, ensuring they are only shown to authorized users. This is done using the DecodePassword function in the page CFSCustomPage, as shown below: This page allows authorized users to view encrypted passwords, MD5, SHA1, SHA512, and AES encrypted passwords, and also decrypt them when necessary. 5. Best Practices for Password Security 6. Encryption Types Used in the System Here are the different types of encryptions and hashing methods used in Business Central: Code: table 71983576 CFSCustomPage { Caption = ‘CustomPage’; DataClassification = ToBeClassified; fields { field(71983575; “No.”; Code[20]) { Caption = ‘No.’; DataClassification = CustomerContent; } field(71983576; Name; Text[50]) { Caption = ‘Name’; DataClassification = CustomerContent; } field(71983577; Password; Text[365]) { Caption = ‘Password’; DataClassification = CustomerContent; } } keys { key(PK; “No.”) { Clustered = true; } } // Procedure to encode (encrypt) a password [ServiceEnabled] procedure EncodePassword(var Password: Text[365]) var EncryptedPassword: Text[365]; begin // Encrypt the password using the Encrypt function EncryptedPassword := Encrypt(Password); // Assign the encrypted password back to the Password field Password := EncryptedPassword; end; // Procedure to decode (decrypt) the password [ServiceEnabled] procedure DecodePassword(EncryptedPassword: Text[365]): Text var DecryptedPassword: Text; begin // Decrypt the password using the Decrypt function DecryptedPassword := Decrypt(EncryptedPassword); // Return the decrypted password exit(DecryptedPassword); end; // Procedure to generate MD5 hash of a password procedure MD5Hash(Pwd: Text): Text var CryptographyManagement: Codeunit “Cryptography Management”; HashAlgorithmType: Option MD5,SHA1,SHA256,SHA384,SHA512; begin // Generate and return the MD5 hash of the password exit(CryptographyManagement.GenerateHash(Pwd, HashAlgorithmType::MD5)); end; // Procedure to generate SHA1 hash of a password procedure SHA1(Pwd: Text): Text var CryptographyManagement: Codeunit “Cryptography Management”; HashAlgorithmType: Option MD5,SHA1,SHA256,SHA384,SHA512; begin // Generate and return the SHA1 hash of the password exit(CryptographyManagement.GenerateHash(Pwd, HashAlgorithmType::SHA1)); end; // Procedure to generate SHA512 hash of a password procedure SHA512(Pwd: Text): Text var CryptographyManagement: Codeunit “Cryptography Management”; HashAlgorithmType: Option MD5,SHA1,SHA256,SHA384,SHA512; begin // Generate and return the SHA512 hash of the password exit(CryptographyManagement.GenerateHash(Pwd, HashAlgorithmType::SHA512)); end; // AES Encryption and Decryption example procedure AESEncryptionExample(Passowrd: Text): TEXT var RijndaelCryptography: Codeunit “Rijndael Cryptography”; Base64Convert: Codeunit “Base64 Convert”; EncryptedText: Text; DecryptedText: Text; SecretTexts: SecretText; begin // Convert the encryption key ‘1106198321061984’ to Base64 format and store it in SecretTexts SecretTexts := Base64Convert.ToBase64(‘1106198321061984’); // Set the encryption key and initialization vector (IV) using Base64-encoded values RijndaelCryptography.SetEncryptionData(SecretTexts, Base64Convert.ToBase64(‘ITGateWayXyZ1234’)); // Set the AES block size to 128 bits (standard AES block size) RijndaelCryptography.SetBlockSize(128); // Set the cipher mode for AES to CBC (Cipher Block Chaining) RijndaelCryptography.SetCipherMode(‘CBC’); // Set the padding mode for AES encryption to PKCS7 (standard padding scheme for block ciphers) RijndaelCryptography.SetPaddingMode(‘PKCS7’); // Encrypt the password using AES encryption EncryptedText := RijndaelCryptography.Encrypt(Passowrd); // Decrypt the encrypted password using … Continue reading Implementing Encryption and Decryption Functions via API in Business Central
Share Story :
Business Central Translations: Working with XLIFF Files – Part 2
By the end of this guide, you will be able to generate, edit, and implement XLIFF files in Microsoft Dynamics 365 Business Central to support multiple languages seamlessly. This will enable your application to display translated content for UI labels, reports, and messages, ensuring a smooth experience for users across different regions. Why does this matter? Using XLIFF files, businesses can easily localize Business Central applications without modifying source code, making multilingual support efficient and scalable. By leveraging tools like NAB AL Tools, translations can be managed effortlessly, enhancing global usability. Generating an XLIFF File To illustrate the XLIFF process, let’s go through an example where we add a custom field named “Custom_Field” on the Customer Card page. Step 1: Creating a Custom Field First, we create a new field, Custom_Field, on the Customer Card page using AL code: Step 2: Enabling Translation File Feature In the app.json file, ensure that the TranslationFile feature is enabled: Step 3: Building the Project Now, build the extension using the shortcut CTRL + Shift + B. This will generate an .xlf file automatically in the translation folder. By default, the file is generated in English (en-US). Using NAB Extension for Translation To simplify translation tasks, you can install the NAB AL Tools extension from the Visual Studio Code marketplace. This extension helps in managing translation files efficiently by allowing automated translation suggestions and quick file updates. Steps to Use NAB AL Tools: A) Install NAB AL Tools. B) Press CTRL + Shift + P and select NAB: Create translation XLF for new language. C) Enter the language code (e.g., fr-FR for French – France). D) Choose Yes when prompted to match translations from BaseApp. E) A new fr-FR.xlf file will be generated. Translating the XLIFF File To translate the XLIFF file into another language (e.g., French), follow these steps: Example: Translating Report Labels In Business Central RDLC reports, hardcoded text values can also be translated using labels. Instead of writing static text, define labels within the AL code: Using FieldCaption ensures that report labels dynamically adapt to the selected language, improving localization without manual modifications. When switching languages, the label automatically retrieves the corresponding translation from the XLIFF file. Modifying Standard Fields Standard field names in Business Central can also be modified using the BaseApplication.g.xlf file. You can find this file in public repositories, such as: BaseApplication.g.xlf Modifying this file allows changes to default field captions and system messages in multiple languages. Insert value in different languages via AL In Microsoft Dynamics 365 Business Central, AL enables efficient multilingual data handling. The image above illustrates a Customer Card where the “Nom” (Name) field contains the value “testing.” The AL code extends the Customer table, adding a custom field and an onInsert trigger to validate the Name field with “testing.” This ensures data consistency across different language settings. By leveraging AL, developers can automate multilingual field values, enhancing Business Central’s global usability. To conclude, managing translations in Business Central using XLIFF files enables businesses to support multiple languages efficiently. By generating XLIFF files, modifying them for translation, and leveraging tools like NAB AL Tools, businesses can ensure accurate and seamless localization. For further refinements, modifying report labels and system fields enhances multilingual support, improving the user experience across global deployments. We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.
Share Story :
Business Central Translations: Language Setup and Customization – Part 1
In today’s globalised world, firms frequently operate in numerous areas and languages. To efficiently manage worldwide operations, software with multilingual capabilities is required. Microsoft Dynamics 365 Business Central (BC) includes a powerful translation system that enables enterprises to customise language choices, thereby increasing user experience and operational efficiencies. This article looks at how translations function in Business Central and how they may be used to support global business operations. Why Are Translations Important in Business Central? Businesses that expand into new areas face a variety of languages, currencies, and regulatory regimes. Ensuring that employees can interact with Business Central in their native language improves the software’s usability and productivity. Business Central allows users to configure numerous languages across various modules, allowing workers to work smoothly in their favourite language. It also allows translations for custom fields, reports, and data entry, assuring consistency and correctness in both internal and external interactions. How Translation Works in Business Central Business Central supports several languages, including English, French, German, and Spanish. Here’s an outline on how to activate and use translations successfully. 1. Configuring Language Settings The first step in enabling multilingual support is to configure the Language Settings in Business Central. Users can choose their favourite language or use the organization’s default language settings. This guarantees that when a user logs in, the interface, menus, and forms appear in their preferred language. To configure a language in Business Central: 2. Standard Text Translations Business Central provides built-in translations for standard interface elements and commonly used terms such as “Sales Orders,” “Invoices,” and “Purchase Orders.” These translations are included in the base application by Microsoft. For example, changing the language from English to French automatically updates the captions. However, some standard texts may not be translated by default. To install additional language support: Once installed, the system updates with the new language settings, ensuring a localized user experience. 3. Translating Custom Fields Many businesses customize Business Central by adding custom fields, tables, and industry-specific terminology. While these enhancements improve operational efficiency, they may not be automatically translated in the base system. To resolve this, Business Central provides the CaptionML property, which allows developers to define multilingual captions for custom elements. Example: English: Displays field names and labels in English. French: The same fields are shown with French translations. By implementing the CaptionML property, businesses ensure a seamless multilingual experience even for customized elements. To conclude, Microsoft Dynamics 365 Business Central makes it simple for multinational companies to handle multilingual customers. Companies can improve usability and efficiency across regions by changing language settings, adding extra translations, and ensuring that custom fields are translated using CaptionML. Embracing Business Central’s translation skills enables firms to operate efficiently in a global market while providing a consistent and localized experience to all users. We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.
Share Story :
Enhancing the Recurring General Journal with Automated Approval Workflows in Dynamics 365 Business Central
In any accounting or financial system, ensuring that the proper approvals are in place is critical for maintaining audit trails and accountability. Microsoft Dynamics 365 Business Central (BC) offers powerful approval workflows that can automate this process, ensuring compliance and accuracy in your financial entries. This blog will guide you through creating an extension for the Recurring General Journal page, enabling automated approval requests for journal batches and journal lines. Understanding the Recurring General Journal The Recurring General Journal in Business Central allows users to post transactions that occur periodically, such as monthly expenses. However, posting journal entries often requires an approval process to guarantee compliance and accuracy. Our extension will empower users to request approvals, cancel requests, and manage the approval status directly from the Recurring General Journal. Solution Outline This extension will: Code Here’s the complete PageExtension code that extends the Recurring General Journal page: pageextension 50103 RecurringGenJnl extends “Recurring General Journal” { layout { addafter(CurrentJnlBatchName) { field(StatusLine; Rec.StatusBatch) { ApplicationArea = All; Caption = ‘Approval Status’; Editable = false; Visible = true; } } } actions { addafter(“F&unctions”) { group(“Request Approval”) { Caption = ‘Request Approval’; group(SendApprovalRequest) { Caption = ‘Send Approval Request’; Image = SendApprovalRequest; action(SendApprovalRequestJournalLine) { ApplicationArea = Basic, Suite; Caption = ‘Journal Batch’; Image = SendApprovalRequest; Enabled = true; ToolTip = ‘Send all journal lines for approval, also those that you may not see because of filters.’; trigger OnAction() var GenJournalLine: Record “Gen. Journal Line”; GenJournalBatch: Record “Gen. Journal Batch”; ApprovalsMgmt: Codeunit “Approvals Mgmt.”; IsLineValid: Boolean; begin GenJournalBatch.Get(Rec.”Journal Template Name”, Rec.”Journal Batch Name”); if GenJournalLine.SetCurrentKey(“Journal Template Name”, “Journal Batch Name”) then begin GenJournalLine.SetRange(“Journal Template Name”, GenJournalBatch.”Journal Template Name”); GenJournalLine.SetRange(“Journal Batch Name”, GenJournalBatch.”Name”); if GenJournalLine.FindSet() then ApprovalsMgmt.TrySendJournalBatchApprovalRequest(GenJournalLine); SetControlAppearanceFromBatch(); SetControlAppearance(); end; end; } } group(CancelApprovalRequest) { Caption = ‘Cancel Approval Request’; Image = Cancel; Enabled = true; action(CancelApprovalRequestJournalBatch) { ApplicationArea = Basic, Suite; Caption = ‘Journal Batch’; Image = CancelApprovalRequest; ToolTip = ‘Cancel sending all journal lines for approval, also those that you may not see because of filters.’; trigger OnAction() var ApprovalsMgmt: Codeunit “Approvals Mgmt.”; GenJournalBatch: Record “Gen. Journal Batch”; GenJournalLine: Record “Gen. Journal Line”; IsLineValid: Boolean; begin GenJournalBatch.Get(Rec.”Journal Template Name”, Rec.”Journal Batch Name”); //ApprovalsMgmt.TryCancelJournalBatchApprovalRequest(GenJournalLine); if GenJournalLine.SetCurrentKey(“Journal Template Name”, “Journal Batch Name”) then begin GenJournalLine.SetRange(“Journal Template Name”, GenJournalBatch.”Journal Template Name”); GenJournalLine.SetRange(“Journal Batch Name”, GenJournalBatch.”Name”); if GenJournalLine.FindSet() then IsLineValid := true; if (GenJournalLine.Status.ToUpper() = ‘OPEN’) or (GenJournalLine.Status.ToUpper() = ‘APPROVED’) then begin IsLineValid := false; end; if IsLineValid then ApprovalsMgmt.TryCancelJournalBatchApprovalRequest(GenJournalLine); //ApprovalsMgmt.TryCancelJournalLineApprovalRequests(GenJournalLine); end else begin Message(‘Gen. Journal Batch not found for the provided template and batch names.’); end; SetControlAppearanceFromBatch(); SetControlAppearance(); end; } } group(Approval) { Caption = ‘Approval’; action(Approve) { ApplicationArea = All; Caption = ‘Approve’; Image = Approve; ToolTip = ‘Approve the requested changes.’; Visible = true; trigger OnAction() var ApprovalsMgmt: Codeunit “Approvals Mgmt.”; begin ApprovalsMgmt.ApproveGenJournalLineRequest(Rec); end; } action(Reject) { ApplicationArea = All; Caption = ‘Reject’; Image = Reject; ToolTip = ‘Reject the approval request.’; Visible = true; trigger OnAction() var ApprovalsMgmt: Codeunit “Approvals Mgmt.”; begin ApprovalsMgmt.RejectGenJournalLineRequest(Rec); end; } action(Delegate) { ApplicationArea = All; Caption = ‘Delegate’; Image = Delegate; ToolTip = ‘Delegate the approval to a substitute approver.’; Visible = OpenApprovalEntriesExistForCurrUser; trigger OnAction() var ApprovalsMgmt: Codeunit “Approvals Mgmt.”; begin ApprovalsMgmt.DelegateGenJournalLineRequest(Rec); end; } } } } } trigger OnOpenPage() begin SetControlAppearanceFromBatch(); end; trigger OnAfterGetCurrRecord() var GenJournalBatch: Record “Gen. Journal Batch”; begin EnableApplyEntriesAction(); SetControlAppearance(); if GenJournalBatch.Get(GetJournalTemplateNameFromFilter(), CurrentJnlBatchName) then SetApprovalStateForBatch(GenJournalBatch, Rec, OpenApprovalEntriesExistForCurrUser, OpenApprovalEntriesOnJnlBatchExist, OpenApprovalEntriesOnBatchOrAnyJnlLineExist, CanCancelApprovalForJnlBatch, CanRequestFlowApprovalForBatch, CanCancelFlowApprovalForBatch, CanRequestFlowApprovalForBatchAndAllLines, ApprovalEntriesExistSentByCurrentUser, EnabledGenJnlBatchWorkflowsExist, EnabledGenJnlLineWorkflowsExist); ApprovalMgmt.GetGenJnlBatchApprovalStatus(Rec, Rec.StatusBatch, EnabledGenJnlBatchWorkflowsExist); end; trigger OnAfterGetRecord() var GenJournalLine: Record “Gen. Journal Line”; GenJournalBatch: Record “Gen. Journal Batch”; ApprovalsMgmt: Codeunit “Approvals Mgmt.”; begin GenJnlManagement.GetAccounts(Rec, AccName, BalAccName); Rec.ShowShortcutDimCode(ShortcutDimCode); SetUserInteractions(); GenJournalBatch.Get(Rec.”Journal Template Name”, Rec.”Journal Batch Name”); if GenJournalLine.SetCurrentKey(“Journal Template Name”, “Journal Batch Name”) then begin GenJournalLine.SetRange(“Journal Template Name”, GenJournalBatch.”Journal Template Name”); GenJournalLine.SetRange(“Journal Batch Name”, GenJournalBatch.”Name”); if GenJournalLine.FindSet() then repeat ApprovalMgmt.GetGenJnlLineApprovalStatus(Rec, Rec.StatusBatch, EnabledGenJnlLineWorkflowsExist); until GenJournalLine.Next() = 0; end; end; trigger OnModifyRecord(): Boolean var GenJournalBatch: Record “Gen. Journal Batch”; GenJournalLine: Record “Gen. Journal Line”; ApprovalsMgmt: Codeunit “Approvals Mgmt.”; IsLineValid: Boolean; begin SetUserInteractions(); ApprovalMgmt.CleanGenJournalApprovalStatus(Rec, Rec.StatusBatch, Rec.Status); if Rec.StatusBatch = ‘Pending Approval’ then Error(‘Modification not allowed. The journal batch “%1” has entries with a status of “Pending Approval”. Please approve, reject, or cancel these entries before making changes.’, GenJournalBatch.”Name”); end; var GenJnlManagement: Codeunit GenJnlManagement; JournalErrorsMgt: Codeunit “Journal Errors Mgt.”; BackgroundErrorHandlingMgt: Codeunit “Background Error Handling Mgt.”; ApprovalMgmt: Codeunit “Approvals Mgmt.”; ChangeExchangeRate: Page “Change Exchange Rate”; GLReconcile: Page Reconciliation; GenJnlBatchApprovalStatus: Text[20]; GenJnlLineApprovalStatus: Text[20]; Balance: Decimal; TotalBalance: Decimal; NumberOfRecords: Integer; ShowBalance: Boolean; ShowTotalBalance: Boolean; HasIncomingDocument: Boolean; BalanceVisible: Boolean; TotalBalanceVisible: Boolean; StyleTxt: Text; ApprovalEntriesExistSentByCurrentUser: Boolean; OpenApprovalEntriesExistForCurrUser: Boolean; OpenApprovalEntriesOnJnlBatchExist: Boolean; OpenApprovalEntriesOnJnlLineExist: Boolean; OpenApprovalEntriesOnBatchOrCurrJnlLineExist: Boolean; OpenApprovalEntriesOnBatchOrAnyJnlLineExist: Boolean; EnabledGenJnlLineWorkflowsExist: Boolean; EnabledGenJnlBatchWorkflowsExist: Boolean; ShowWorkflowStatusOnBatch: Boolean; ShowWorkflowStatusOnLine: Boolean; CanCancelApprovalForJnlBatch: Boolean; CanCancelApprovalForJnlLine: Boolean; ImportPayrollTransactionsAvailable: Boolean; CanRequestFlowApprovalForBatch: Boolean; CanRequestFlowApprovalForBatchAndAllLines: Boolean; CanRequestFlowApprovalForBatchAndCurrentLine: Boolean; CanCancelFlowApprovalForBatch: Boolean; CanCancelFlowApprovalForLine: Boolean; BackgroundErrorCheck: Boolean; ShowAllLinesEnabled: Boolean; CurrentPostingDate: Date; protected var ApplyEntriesActionEnabled: Boolean; IsSimplePage: Boolean; local procedure EnableApplyEntriesAction() begin ApplyEntriesActionEnabled := (Rec.”Account Type” in [Rec.”Account Type”::Customer, Rec.”Account Type”::Vendor, Rec.”Account Type”::Employee]) or (Rec.”Bal. Account Type” in [Rec.”Bal. Account Type”::Customer, Rec.”Bal. Account Type”::Vendor, Rec.”Bal. Account Type”::Employee]); OnAfterEnableApplyEntriesAction(Rec, ApplyEntriesActionEnabled); end; local procedure CurrentJnlBatchNameOnAfterVali() begin CurrPage.SaveRecord(); GenJnlManagement.SetName(CurrentJnlBatchName, Rec); SetControlAppearanceFromBatch(); CurrPage.Update(false); end; procedure SetUserInteractions() begin StyleTxt := Rec.GetStyle(); end; local procedure GetCurrentlySelectedLines(var GenJournalLine: Record “Gen. Journal Line”): Boolean begin CurrPage.SetSelectionFilter(GenJournalLine); exit(GenJournalLine.FindSet()); end; local procedure GetPostingDate(): Date begin if IsSimplePage then exit(CurrentPostingDate); exit(Workdate()); end; internal procedure SetApprovalState(RecordId: RecordId; OpenApprovalEntriesOnJournalBatchExist: Boolean; LocalCanRequestFlowApprovalForBatch: Boolean; var LocalCanCancelFlowApprovalForLine: Boolean; var OpenApprovalEntriesExistForCurrentUser: Boolean; var OpenApprovalEntriesOnJournalLineExist: Boolean; var OpenApprovalEntriesOnBatchOrCurrentJournalLineExist: Boolean; var CanCancelApprovalForJournalLine: Boolean; var LocalCanRequestFlowApprovalForBatchAndCurrentLine: Boolean) var ApprovalsMgmt: Codeunit “Approvals Mgmt.”; WorkflowWebhookManagement: Codeunit “Workflow Webhook Management”; CanRequestFlowApprovalForLine: Boolean; begin OpenApprovalEntriesExistForCurrentUser := OpenApprovalEntriesExistForCurrentUser or ApprovalsMgmt.HasOpenApprovalEntriesForCurrentUser(RecordId); OpenApprovalEntriesOnJournalLineExist := ApprovalsMgmt.HasOpenApprovalEntries(RecordId); OpenApprovalEntriesOnBatchOrCurrentJournalLineExist := OpenApprovalEntriesOnJournalBatchExist or OpenApprovalEntriesOnJournalLineExist; CanCancelApprovalForJournalLine := ApprovalsMgmt.CanCancelApprovalForRecord(RecordId); WorkflowWebhookManagement.GetCanRequestAndCanCancel(RecordId, CanRequestFlowApprovalForLine, LocalCanCancelFlowApprovalForLine); LocalCanRequestFlowApprovalForBatchAndCurrentLine := LocalCanRequestFlowApprovalForBatch and CanRequestFlowApprovalForLine; end; internal procedure SetApprovalStateForBatch(GenJournalBatch: Record “Gen. Journal Batch”; GenJournalLine: Record “Gen. Journal Line”; var OpenApprovalEntriesExistForCurrentUser: Boolean; var OpenApprovalEntriesOnJournalBatchExist: Boolean; var OpenApprovalEntriesOnBatchOrAnyJournalLineExist: Boolean; var CanCancelApprovalForJournalBatch: Boolean; var LocalCanRequestFlowApprovalForBatch: Boolean; var LocalCanCancelFlowApprovalForBatch: Boolean; var LocalCanRequestFlowApprovalForBatchAndAllLines: Boolean; var LocalApprovalEntriesExistSentByCurrentUser: Boolean; var EnabledGeneralJournalBatchWorkflowsExist: Boolean; var EnabledGeneralJournalLineWorkflowsExist: Boolean) var ApprovalsMgmt: Codeunit “Approvals Mgmt.”; WorkflowWebhookManagement: Codeunit “Workflow Webhook Management”; WorkflowEventHandling: Codeunit “Workflow Event Handling”; WorkflowManagement: Codeunit “Workflow Management”; CanRequestFlowApprovalForAllLines: Boolean; begin OpenApprovalEntriesExistForCurrentUser := OpenApprovalEntriesExistForCurrentUser or ApprovalsMgmt.HasOpenApprovalEntriesForCurrentUser(GenJournalBatch.RecordId); OpenApprovalEntriesOnJournalBatchExist := ApprovalsMgmt.HasOpenApprovalEntries(GenJournalBatch.RecordId); OpenApprovalEntriesOnBatchOrAnyJournalLineExist := OpenApprovalEntriesOnJournalBatchExist or ApprovalsMgmt.HasAnyOpenJournalLineApprovalEntries(GenJournalLine.”Journal Template Name”, GenJournalLine.”Journal Batch Name”); CanCancelApprovalForJournalBatch := … Continue reading Enhancing the Recurring General Journal with Automated Approval Workflows in Dynamics 365 Business Central